package com.xiaozhengkeji.springboot.frame.easy.config;

import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.Config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class AliPayEasySDKConfig {
    public AliPayEasySDKConfig() {
        Factory.setOptions(getOptionsDev());
        log.info("支付宝SDK初始化完成");
    }

    private static Config getOptionsDev() {
        Config config = new Config();
        config.protocol = "https";
        config.gatewayHost = "openapi.alipaydev.com";
        config.signType = "RSA2";
        config.appId = "2016102200738810";
        // 为避免私钥随源码泄露，推荐从文件中读取私钥字符串而不是写入源码中
        config.merchantPrivateKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQChOp3TVnUFS50Cy5FqkNi7gm2xqjOpV4IcHjX2dnMpKfWglNvVC7Ysvrhd5+bC4kgPA77+vvbGshQed8rQhHQtJOufakg1DEZZRxq6vDFFsry9IZvSwawr1APdlbMAZpz4xUjQiE9vdhsR980MURhMqe06+O8SCDHc5xQDwMXXGIWroQmNU7qtV/OkpDymkZXPRM4ixkEU/Tfjq0a86vojduHQQEXRkhj0eel9Lu+srFCbad6YD/0Ohv3f2emZ9qoyO9/tBd10ULQkOWNBEdPbvQwC1oYr7B91ucKfT4fKd3UC17/aGtrxyHOvllNdS7fdt4boeFYulh+k4F4jKOF5AgMBAAECggEAQjqa5FpqfX9fAuvuUxEnBneAae/ZguGAf95lGlXz3l/vF0SuvOgvsFez0ldVco6TPR+z0F9PbbVvEEjzFg6iznyREY4OFURyjW/o6fYuY0wVvbdVlBCckfBomhhJTIvaRVJ9I7QqtUWVvx7Eqx+Q1MUkvwnM4uJc4TpG/XetjTpNkXUda9G6sSVe7egWLN++DXPN+PjgTGL5/vAcrEzd3BCLKHIffAnpq6X6UuMZxsEe69mNumJt4dhUwVt5GiQAq9coOi86wg8QMHn6ey1uvzaUdTVgIheSAHXs0QhW1Ac3cZQxlPyIxUU11QTfE/BaLrCVhwNxD7MtX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VEDOWy3SDYvh6O58aG4Vbjgqhr1301okZiANefHoTREJawbfYQI/nPJK65pJFGSVD8H5PwOCdv42bJfwnmtdvQ9xM7wZAkO16200b9RF7VjM3NzA0Q0v30jjDxA2oRYhqaaBwxYLdU6tyu9vGZPTnGUEaYRgUUFRQBOezFcGuTseg/RkFUraArBnyWKc8/XTfEA0WDwDO5DUNLTYNUldcE7JHwIDAQAB";
        //可设置异步通知接收服务地址（可选）
        config.notifyUrl = "";
        //可设置AES密钥，调用AES加解密相关接口时需要（可选）
        config.encryptKey = "<-- 请填写您的AES密钥，例如：aa4BtZ4tspm2wnXLb1ThQA== -->";
        return config;
    }
}
